#include <iostream>
#include <mysql/mysql.h>
int main()
{
    MYSQL* mysql=mysql_init(nullptr);
    mysql_real_connect(mysql,"127.0.0.1","root","An15294874732.","test",8080,nullptr,0);
    mysql_set_character_set(mysql, "utf8");
    int mysql_query(MYSQL *mysql, const char *q);
    MYSQL_RES *mysql_store_result(MYSQL *mysql);

    //mysql_query(mysql, "insert into t (number) values('58623');");
    mysql_query(mysql, "select * from t;");
    MYSQL_RES* res=mysql_store_result(mysql);
    int rows=mysql_num_rows(res);
    int fields =mysql_num_fields(res);
    MYSQL_FIELD* f= mysql_fetch_fields(res);
    
    for(int i=0;i<fields;i++)
    {
        std::cout<<f[i].name<<" ";
    }
    std::cout<<std::endl;
    MYSQL_ROW r;
    for(int i=0;i<rows;i++)
    {
        r=mysql_fetch_row(res);
        for(int j=0;j<fields;j++)
        {
             std::cout<<r[j]<<" ";
        }
        std::cout<<std::endl;

        

    }
    mysql_free_result(res);


    mysql_close(mysql);
    return 0;
}